<layout name="page" />
<block name="content">
	{:widget('page_header/simple',array('name'=>'新建客户'))}
	<form method='post' id="form_data" class="row frame">
		<input type="hidden" name="opmode" value="add">
		<div class="box col-6">
			<label class=" input-label" for="name">姓名*：</label>
			<input class="input" type="text" id="name" name="name"
			check="required" info="请输入姓名">
		</div>
		<div class="box col-6">
			<label class="input-label" for="company">公司：</label>
			<div class="input-box">
				<input name="company_id" id="company_id" type="hidden" info="请选择上级部门" check="required" />
				<input class="input" id="company_name" name="company_name" type="text" readonly="readonly" info="请选择上级部门" check="required" />
				<a class="add-on w6" onclick="select_company();">选择</a>
			</div>
		</div>
		<div class="box col-6">
			<label class=" input-label" for="dept">部门：</label>
			<input class="input" type="text" id="dept" name="dept">
		</div>
		<div class="box col-6">
			<label class=" input-label" for="position">职位：</label>
			<input class="input" type="text" id="position" name="position">
		</div>
		<div class="box col-6">
			<label class=" input-label" for="office_tel">办公电话*：</label>
			<input class="input" type="text" id="office_tel" name="office_tel" check="required" info="请输入办公电话">
		</div>
		<div class="box col-6">
			<label class=" input-label" for="mobile_tel">手机：</label>
			<input class="input" type="text" id="mobile_tel" name="mobile_tel">
		</div>
		<div class="box col-6">
			<label class=" input-label" for="email">邮件：</label>
			<input class="input" type="text" id="email" name="email">
		</div>
		<div class="box col-6">
			<label class=" input-label" for="im">即时聊天：</label>
			<input class="input" type="text" id="im" name="im">
		</div>
		<hr style="width:100%;">
		<div class="box col-6">
			<label class=" input-label" for="address">产品：</label>
			<div class="input-box">
				<input name="product_id" id="product_id" type="hidden" info="请选择上级部门" check="required" />
				<input class="input" id="product_name" name="product_name" type="text" readonly="readonly" info="请选择上级部门" check="required" />
				<a class="add-on w6" onclick="select_product();">选择</a>
			</div>
		</div>
		<div class="box col-6">
			<label class=" input-label" for="salesman">业务员：</label>
			<div class="input-box">
				<input name="salesman_id" id="salesman_id" type="hidden" info="请选择上级部门" check="required" />
				<input class="input" id="salesman_name" name="salesman_name" type="text" readonly="readonly" info="请选择上级部门" check="required" />
				<a class="add-on w6" onclick="select_salesman();">选择</a>
			</div>
		</div>
		<foreach name="field_list" val="udf_vo">
			{:widget('user_define_field/edit',array($udf_vo))}
		</foreach>
		<div class="box col-12">
			<label class="input-label" for="name">附件：</label>
			{:widget('file_upload/add')}
		</div>
		<div class="box col-12">
			<label class="input-label" for="remark">其他：</label>
			<textarea class="textarea simple" name="remark"></textarea>
		</div>
		<div class="box col-12">
			<label class="input-label"></label>
			<a class="btn btn-normal" onclick="save()">保存</a>
			<a class="btn btn-return" onclick="go_return_url();">取消</a>
		</div>
	</form>
</block>
<block name="js">
	<script type="text/javascript">
		layui.use(['global', 'uploader'], function() {
			var $ = layui.jquery;
			var fn = {
				select_company : function() {
					winopen('{:url("select_company")}', 560, 470);
				},
				select_product : function() {
					winopen('{:url("select_product")}', 560, 470);
				},
				select_salesman : function() {
					winopen('{:url("select_salesman")}', 560, 470);
				},
				save : function() {
					send_form("form_data", "{:url('save')}", "{:url('index')}", function(ret) {
						if (ret.status) {
							layer.msg(ret.info, {
								time : 1200
							}, function() {
								location.href = "{:url('index')}";
							});
						} else {
							layer.msg(ret.info);
							return false;
						}
					});
				},
			};
			win_exp(fn);
		});
	</script>
</block>
